*  FILE NAME: PRECOM.PRG
*  BY: NURJADI PURNAMA
*  DATE: January 11, 1996
*  DESC:
*  CALLED BY:
*  DATA FILES:
store 0 to PL1,PL2,SW,pilc,MESC
do while pilc<>1
   set colo to bg+/b
    @ 9,1 CLEA TO 23,78
   COCOD=SPACE(4)
   PATCRP=SPACE(4)
   conam=space(32)
   COADD1=space(32)
   COadd2=space(32)
   COcity=space(25)
   COTEL1=space(15)
   COFAX=space(15)
   COTELEX=space(15)
   do while conam=space(32)
      compin=space(5)
      do boxe with 10,3,'Enter Initial of company name : ','COMPIN','N','BG','W+','N',5,.T.,.T.
      if lastkey()=27
         return
      endif
       do patcomp
      if mesc=1
         return
      endif
   enddo
   SET COLOR TO BG+/B
   @  8, 1 CLEA TO 23,78
   SET COLOR TO W/N
   @ 10, 4 CLEA TO 14,77
   SET COLOR TO BG+/RB,W+/N
   @  9, 2  TO 13,75 DOUBLE
   @ 10, 3  SAY " CLIENT  : "+CONAM+SPACE(8)+'CODE : '+COCOD+SPACE(6)
   @ 11, 3  SAY " ADDRESS : "+COadd1+' '
   @ 12, 3  SAY " TEL : "+COtel1+" FAX : "+COfax+" TELEX : "+COtelex+' '
   DO BOX2 WITH 20,26,"DO YOU CONFIRM :",'YES','NO','GR+','R','GR+','N',PILC,.T.,.T.
   SET COLOR TO W+/B,W+/N
   IF PILC=2
      @ 10,3 CLEA TO 23,78
      loop
   ENDIF
   if lastkey()=27
      return
   endif
ENDDO
set color to bg+/b
@ 15,1 clea to 23,78
do boxf with 17,32,'PROCESSING ... ','GR+','R','GR+*',.T.,.T.
set color to w+/b
DATEEND=DATE()
HLINE=.f.
SELE 1
set exclu off
USE &DR&F1 index &dr&F13
GO TOP
seek COCOD
NOTF=.F.
if eof()
   if aeaheal
      do nonhlP
      NOTF=.T.
   endif
   return
endif
DO WHILE PAT_CODCRP=COCOD .and. .NOT. EOF()
   IF AEAHEAL
     IF HEALTHLINE .AND. hl_end>date()
        HLINE=.t.
        IF HL_END>DATEEND
           DATEEND=HL_END
        ENDIF
     ENDIF
   ENDIF
   SKIP
ENDDO
set color to W+/b,W+/N
@ 15,1 clea to 23,78
IF HLINE
   @ 8, 28 SAY "HEALTHLINE CORPORATE MEMBERSHIP UNTIL : "+DTOC(DATEEND)
ENDIF
SELE 1
SET EXCLU OFF
USE &DR&F1 INDEX &DR&F13
SEEK COCOD
CNT=0
DO WHILE pat_codcrp=COcod .and. .NOT. EOF()
   IF AEAHEAL
      IF HEALTHLINE .and. hl_end>date()
         cnt=cnt+1
      ENDIF
   ELSE
      CNT=CNT+1
   ENDIF
   skip
enddo
if cnt=0
   IF AEAHEAL
      DO NONHLP
   ENDIF
   SET COLO TO BG+/B,W+/N
   @ 8,1 CLEAR TO 23,77
   return
endif
set colo to bg+/b+
declare NAMA[cnt]
declare KRED[cnt]
DECLARE FILD1[CNT]
DECLARE KODPAT[CNT]
DECLARE RECN[CNT]
go top
seek COcod
CR=0
DO WHILE pat_codcrp=COcod .and..NOT. EOF()
   IF AEAHEAL
      if healthline .AND. hl_end>date()
         IF hl_dent
            dent='Y'
         ELSE
            dent='N'
         ENDIF
         CR=CR+1
         cri=str(cr,4,0)
         fild1[cr]=cri+" "+pat_filcod+' '+pat_codcrp+" "+pat_codcre+" "+pat_coddat+" "+PAT_CODTYP+' '+chr(179)+' '+pat_name+chr(179)+' '+pat_f_name+chr(179)+' '+dtoc(hl_end)+'  '+dent
         KODPAT[CR]=PAT_FILCOD
         RECN[CR]=RECNO()
      ENDIF
   ELSE
      CR=CR+1
      cri=str(cr,4,0)
      fild1[cr]=cri+" "+pat_filcod+' '+pat_codcrp+" "+pat_codcre+" "+pat_coddat+" "+PAT_CODTYP+' '+chr(179)+' '+pat_name+chr(179)+' '+pat_f_name+chr(179)
      KODPAT[CR]=PAT_FILCOD
      RECN[CR]=RECNO()
   ENDIF
   skip
enddo
DO WHILE lastkey()<>27
   set colo to bg+/b
   SET COLO TO BG+/B,W+/N
   @ 15,1 clear to 23,78
   @ 15,6 say '   Code                 Name              First Name        Validity  D'
   @ 16,2 to 16,77 Double
   cari=achoice(17,2,22,77,fild1)
   DO CASE
   CASE lastkey()=13
        KODEPAT=KODPAT[CARI]
        REC=RECN[CARI]
        EXIT
   case lastkey()=27
        SET COLO TO BG+/B,W+/N
        @ 8,1 CLEAR TO 23,78
        return
   OTHER
        LOOP
   ENDCASE
ENDDO
SET COLO TO BG+/B,W+/N
@ 8,1 CLEAR TO 23,78
RETURN

*Formatted by: Herman T Ver. 7.1  on January 11, 1996.
